﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MvcToolbox;

namespace TestMvcToolbox.Models
{
    [MapDto(typeof(PersonDto))]
    public class Person
    {
        public string Firstname { get; set; }
        public string Lastname { get; set; }

        public override string ToString()
        {
            return Firstname + " " + Lastname;
        }

        private static void Map()
        {
            AutoMapper.Mapper.CreateMap<PersonDto, Person>();
            AutoMapper.Mapper.CreateMap<PagedList<PersonDto>, PagedList<Person>>()
                .AfterMap((s, d) => AutoMapper.Mapper.Map<List<PersonDto>, List<Person>>(s, d));
        }
    }




    public class PersonDto
    {
        public string Firstname { get; set; }
        public string Lastname { get; set; }

    }
}